<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        function getSex(sex) {
            // var sex = '女1';
            // if (sex == '男') {
            //     console.log(sex);
            // }
            // if (sex == '女') {
            //         console.log(sex);
            //     }
            if (sex =='男' || sex == '女') {
                console.log(sex); 
                return
            }
            // if (sex != '男' && sex != '女') {
                console.log('未知');
            // }
        }
        getSex('女')

    </script>
</head>

<body>

</body>

</html>